<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="divport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="icon" href="assets/images/favicon.ico"/>
    <title>那可真幸福</title>
    <link rel="stylesheet" href="assets/css/appointment.css"/>
    <link rel="stylesheet" href="assets/libs/layui/css/layui.css"/>
    <link rel="stylesheet" href="assets/module/admin.css?v=318"/>
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body class="layui-fluid">
<div class="layui-card card-box-shadow">
    <div class="layui-card-body">
        <!-- 表格工具栏 -->
        <div class="layui-form toolbar" lay-filter="bugsTbSearchForm">
            <div class="layui-form-item ">
                <div class="layui-inline">
                    <label class="layui-form-label w-auto">内容：</label>
                    <div class="layui-input-inline mr0">
                        <input name="keywords" id="keywords" class="layui-input search_key" type="search" placeholder="内容"/>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label w-auto">性别：</label>
                    <div class="layui-input-inline mr0">
                        <select name="modifer" lay-filter="modifer" id="gender" xm-select="modifer" lay-verType="tips" placeholder="性别" lay-verify="" lay-search>
                            <option value="">请选择</option>
                            <option value="1">男</option>
                            <option value="2">女</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label w-auto">年龄：</label>
                    <div class="layui-input-inline mr0">
                        <select name="modifer" lay-filter="modifer" id="age" xm-select="modifer" lay-verType="tips" placeholder="性别" lay-verify="" lay-search>
                            <option value="">请选择</option>
                            <option value="00后">00后</option>
                            <option value="95后">95后</option>
                            <option value="90后">90后</option>
                            <option value="85后">85后</option>
                            <option value="80后">80后</option>
                            <option value="75后">75后</option>
                            <option value="70后">70后</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label w-auto">离异：</label>
                    <div class="layui-input-inline mr0">
                        <select name="modifer" lay-filter="modifer" id="marriage" xm-select="modifer" lay-verType="tips" placeholder="性别" lay-verify="" lay-search>
                            <option value="">请选择</option>
                            <option value="未婚">未婚</option>
                            <option value="离异">离异</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label w-auto">学历：</label>
                    <div class="layui-input-inline mr0">
                        <select name="modifer" lay-filter="modifer" id="education" xm-select="modifer" lay-verType="tips" placeholder="性别" lay-verify="" lay-search>
                            <option value="">请选择</option>
                            <option value="博士">博士</option>
                            <option value="硕士">硕士研究生</option>
                            <option value="本科">本科</option>
                            <option value="大专">大专</option>
                            <option value="其他">其他</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label w-auto">照片：</label>
                    <div class="layui-input-inline mr0">
                        <select name="modifer" lay-filter="modifer" id="pic" xm-select="modifer" lay-verType="tips" placeholder="照片" lay-verify="" lay-search>
                            <option value="">请选择</option>
                            <option value="有">有</option>
                            <option value="无">无</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label w-auto">隐藏照片:</label>
                    <div class="layui-input-inline mr0">
                        <input type="checkbox" value="1" name="nopic" id="nopic" title="隐藏照片" checked>
                    </div>
                </div>
                <div class="layui-inline">
                    <!--                    <button class="layui-btn icon-btn" lay-filter="bugsTbSearch" id="bugsTbSearch" lay-submit>-->
                    <button class="layui-btn icon-btn" id="bugsTbSearch" >
                        <i class="layui-icon">&#xe615;</i>搜索
                    </button>
                </div>
                <div class="layui-inline">
                    <button class="layui-btn icon-btn" id="copy">
                        <i class="layui-icon">&#xe62e;</i>复制
                    </button>
                </div>
            </div>

        </div>
    </div>
</div>
<blockquote class="layui-elem-quote" style="margin-top: 10px;">
    <div id="test2"></div>
</blockquote>
<div class="container" id="container"></div>

<!-- js部分 -->
<script type="text/javascript" src="assets/libs/layui/layui.js"></script>
<script>
/** EasyWeb spa v3.1.8 date:2020-05-04 License By http://easyweb.vip */
layui.config({
    version: '318',   // 更新组件缓存，设为true不缓存，也可以设一个固定值
    base: 'assets/module/'
}).extend({
    steps: 'steps/steps',
    notice: 'notice/notice',
    cascader: 'cascader/cascader',
    dropdown: 'dropdown/dropdown',
    fileChoose: 'fileChoose/fileChoose',
    Split: 'Split/Split',
    Cropper: 'Cropper/Cropper',
    tagsInput: 'tagsInput/tagsInput',
    citypicker: 'city-picker/city-picker',
    introJs: 'introJs/introJs',
    zTree: 'zTree/zTree',
    ClipboardJS: 'ClipboardJS'
}).use(['layer', 'form', 'table', 'util', 'admin', 'xmSelect', 'ClipboardJS'], function () {

    var $ = layui.jquery;
    var layer = layui.layer;
    var form = layui.form;
    var table = layui.table;
    var util = layui.util;
    var admin = layui.admin;
    var xmSelect = layui.xmSelect;
    var ClipboardJS = layui.ClipboardJS;
    let content = ""
    let clipboard2 = new ClipboardJS('#copy',{
        text: function () {
            return `${content}`
        }
    });
    clipboard2.on('success', function(e) {
        console.log("复制成功！")
        layer.msg("复制成功!", {icon: 1, time: 700});
    });
    clipboard2.on('error', function(e) {
        console.log("当前浏览器不支持此功能，请手动复制。")
    });

    let clipboard3 = new ClipboardJS('.item_copy',{
        text: function (trigger) {
            let con = ''
            let p = $(trigger).parent().next()
            con += p.data('txt') +" "+p.children(':eq(0)').text()+" "+p.children(':eq(1)').text() +"\n"
            p = p.next()
            con += p.text() +"\n"
            p = p.next()
            con += p.text() +"\n"
            p = p.next()
            con += p.text() +"\n"
            p = p.next()
            con += p.text() +"\n"
            p = p.next()
            con += p.text() +"\n"
            p = p.next()
            con += p.text() +"\n"
            p = p.next()
            con += p.text() +"\n"
            p = p.next()
            con += p.text() +"\n"
            p = p.next()
            con += p.text() +"\n"
            p = p.next()
            con += p.text() +"\n"
            return con
        }
    });
    clipboard3.on('success', function(e) {
        layer.msg("复制成功!", {icon: 1, time: 700});
    });
    clipboard3.on('error', function(e) {
        console.log("当前浏览器不支持此功能，请手动复制。")
    });

    search()
    $("#bugsTbSearch").click(function() {
        $("#container").empty()
        search()
        return false;
    })

    function search() {
        let data = {}
        if ($("#keywords").val() != "") {
            data.keywords = $("#keywords").val()
        }
        if ($("#gender").val() != "") {
            data.gender = $("#gender").val()
        }
        if ($("#marriage").val() != "") {
            data.marriage = $("#marriage").val()
        }
        if ($("#age").val() != "") {
            data.age = $("#age").val()
        }
        if ($("#education").val() != "") {
            data.education = $("#education").val()
        }
        if ($("#pic").val() != "") {
            data.pic = $("#pic").val()
        }
        let nopic = true
        if ($("#nopic").prop("checked") == true) {
            nopic = false
        }
        admin.req('api/nt/ap/information/list', data, function (res) {
            content = ""
            if (res.code == 0) {
                $("#test2").html("人数: "+res.data.length)
                res.data.forEach((c, index, arr) => {
                    // if(index>13) {return false}
                    let gender = c.gender == '1' ? '男' : '女'
                    let pic = ""
                    if(nopic) {
                        if (c.pic != "") {
                            pic = "    <div class=\"mt10\">\n" +
                                "        <img class=\"pic\" src=\"" + layui.setter.baseServer + "api/nt/xcxFile/" + c.pic + "\" />\n" +
                                "    </div>"
                        }
                    }

                    $("#container").append("<div class=\"items\">" +
                        "                <div class=\"avatarcontainer\">" +
                        "                <div class=\"item_copy\">复制</div>" +
                        "                <img class=\"avatar\" src=\"" + c.userAvatar + "\"/>\n" +
                        "                <div class=\"ml15\">" + c.userNickName + "</div>\n" +
                        "            </div>\n" +
                        "<div class=\"mt10\" data-txt=" + c.nickname + ">昵称: " + c.nickname + "\n" +
                        "        <span class=\"nicknametext\">" + gender + "</span>\n" +
                        "        <span class=\"nicknametext\">" + c.marriage + "</span>\n" +
                        "    </div>\n" +
                        "    <div class=\"mt10\">年龄: " + c.age + "</div>\n" +
                        "    <div class=\"mt10\">身高/体重: " + c.height + "/" + c.weight + "</div>" +
                        "    <div class=\"mt10\">学历/职业: " + c.education + "/" + c.occupation + "</div>\n" +
                        "    <div class=\"mt10\">房车: " + c.house + "/" + c.car + "</div>\n" +
                        "    <div class=\"mt10\">自身情况: " + c.comment + "</div>\n" +
                        "    <div class=\"mt10\">籍贯: " + c.nativeplace + "</div>\n" +
                        "    <div class=\"mt10\">定居何处: " + c.address + "</div>\n" +
                        "    <div class=\"mt10\">爱好: " + c.hobby + "</div>\n" +
                        "    <div class=\"mt10\">择偶要求: " + c.requirement + "</div>\n" +
                        pic +
                        "            </div>\n"
                    )
                    content += (index+1) + "\n昵称:" + c.nickname + "  " + gender +"  " + c.marriage +"\n"
                        + "年龄: " + c.age +"\n"
                        + "身高/体重: " + c.height + "/" + c.weight +"\n"
                        + "学历/职业: " + c.education + "/" + c.occupation + "\n"
                        + "房车: " + c.house + "/" + c.car + "\n"
                        + "自身情况: " + c.comment + "\n"
                        + "籍贯: " + c.nativeplace + "\n"
                        + "定居何处: " + c.address + "\n"
                        + "爱好: " + c.hobby + "\n"
                        + "择偶要求: " + c.requirement + "\n"
                    if(index!=res.data.length - 1) {
                        content += "\n\n"
                    }
                })
                for(let i = 0; i < 7; i ++) {
                    $("#container").append("<div class=\"items\" style='background-color: transparent;'>" +
                        "            </div>\n"
                    )
                }
            }
        }, 'post');
    }

});
</script>
</body>
</html>